﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows.Data;

namespace DACU.Tools.Converters
{
	class DataItemToIndexConverter : IMultiValueConverter
	{
		public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
		{
			if (values == null || values.Length < 2) return "";
			var collection = values[0] as ItemCollection;
			var item = values[1];
			return item != null && collection != null ? (collection.IndexOf(item) + 1).ToString() : "";
		}

		public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
		{
			throw new NotImplementedException();
		}
	}
}
